home *** CD-ROM | disk | FTP | other *** search
/ Mail Madness! 28 / Mail_Madness_28_200x_-_Side_B.d64 / reformat (.txt) next >
Commodore BASIC  |  2023-02-26  |  6KB  |  228 lines

  1. 1 rem *******************************
  2. 2 rem *       reformat v4.0         *
  3. 3 rem *                             *
  4. 4 rem *  (c) 1985 by georg burger   *
  5. 5 rem *     roiderstrasse 18        *
  6. 6 rem *       8051 zolling          *
  7. 7 rem *******************************
  8. 8 :
  9. 9 :
  10. 10 poke53280,0:poke53281,0:poke646,5:printchr$(142)
  11. 20 open1,8,15,"i":close1:goto1000
  12. 97 :
  13. 98 rem  ---------routinen--------------
  14. 99 :
  15. 100 close5:open5,8,5,"#2":return
  16. 200 input#15,y1$,y2$,y3$,y4$
  17. 210 ifval(y1$)=0thenreturn
  18. 220 print""y1$" "y2$" "y3$" "y4$
  19. 230 print"   use  _ [146] to exit or  f7 [146] to continue"
  20. 240 poke198,0
  21. 250 geta$:ifa$=""then250
  22. 260 ifa$="_"thenrun
  23. 270 ifasc(a$)=136thenreturn
  24. 280 goto250
  25. 300 print"[147][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]";
  26. 310 print"   reformat  v4.0    by  georg burger   [146]";
  27. 320 fori=1to7:print"[165]                                      [167]";:nexti
  28. 330 print"[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]":return
  29. 400 print"old directory-register:":print
  30. 410 print"name",dn$(d1)
  31. 420 print"blocks",dl(d1)
  32. 430 print"track",ds(d1)
  33. 440 print"sector",db(d1)
  34. 450 ef$="y":return
  35. 500 print"              press any key [146]":poke198,0
  36. 510 geta$:ifa$=""then510
  37. 520 return
  38. 600 d1=0
  39. 610 if(ds(d1)=as)and(db(d1)=ab)then400
  40. 620 d1=d1+1:ifd1>=dpthenreturn
  41. 630 goto610
  42. 700 mb=nb:nb=nb+3
  43. 710 ifnb=19thennb=2
  44. 720 ifnb=20thennb=3
  45. 730 return
  46. 997 :
  47. 998 rem --------- menue ---------------
  48. 999 :
  49. 1000 open15,8,15:open5,8,5,"#2"
  50. 1010 dims(35,21),b(35,21),bl(35),di$(29),di(29),a$(255)
  51. 1020 dimsv(35,21),bv(35,21),us(35,21),ds(144),db(144),dl(144),dn$(144),dt(144)
  52. 1030 fori=1to17:bl(i)=20:next:fori=18to24:bl(i)=18:next
  53. 1040 fori=25to30:bl(i)=17:next:fori=31to35:bl(i)=16:next
  54. 1050 gosub300:poke214,4:poke211,0:sys58640
  55. 1060 print"    f1 [146]   reconstruct directory
  56. 1070 [153]"    f7 wait   examine directory":[151]198,0
  57. 1080 [161]a$:[139]a$[178]""[167]1080
  58. 1090 [139][198](a$)[178]133[167][141]100:[137]2000
  59. 1100 [139][198](a$)[178]136[167][141]100:[141]4000:[137]1050
  60. 1110 [137]1080
  61. 1997 :
  62. 1998 [143] --- reconstruct directory ----
  63. 1999 :
  64. 2000 [141]300:[151]214,4:[151]211,0:[158]58640
  65. 2010 [153]"         reconstruct directory
  66. 2020 print"            use  _ [146] to exit
  67. 2030 [153]"totototototototototototototototototototototototototototototototototototototototo";
  68. 2040 [153]" track   sector   to   track     sector wait"
  69. 2050 [129]s[178]1[164]35:[129]b[178]0[164]bl(s)
  70. 2060 [152]15,"b-r:"5;0;s;b:[141]200
  71. 2070 [152]15,"b-p:"5;0:[141]200
  72. 2080 [161]#5,e$
  73. 2090 [161]#5,f$
  74. 2100 e[178][198](e$[170][199](0))
  75. 2110 f[178][198](f$[170][199](0))
  76. 2120 [153]"  "s,b,"    "e,"    "f
  77. 2130 [161]a$:[139]a$[178]""[167]2150
  78. 2140 [139]a$[178]"_"[167][160]15:[138]
  79. 2150 [139]e[178]75[175]f[178]1[167]us(s,b)[178][171]2:[137]2200
  80. 2160 [139]e[177]35[167]e[178]0
  81. 2170 [139]f[177]21[167]f[178]21
  82. 2180 s(s,b)[178]e:b(s,b)[178]f
  83. 2190 sv(e,f)[178]s:bv(e,f)[178]b:us(e,f)[178]us(e,f)[170]1
  84. 2200 [130]:[130]
  85. 2210 [143] ------ critical blocks -------
  86. 2220 [141]300:[151]214,5:[151]211,0:[158]58640
  87. 2230 [153]"            critical blocks
  88. 2240 print" track   sector   lenght [146]":print
  89. 2250 fors=1to35
  90. 2260 forb=0tobl(s)
  91. 2270 ifus(s,b)<2then2290
  92. 2280 print"  "s,b,us(s,b)
  93. 2290 next:next
  94. 2300 print"          end of critical blocks [146]"
  95. 2310 gosub500:gosub300:poke214,4:poke211,0:sys58640
  96. 2320 print"   use old directory to name files ?
  97. 2330 [153]"                (y/n)
  98. 2340 getda$:ifda$=""then2340
  99. 2350 ifda$<>"n"thenda$="y":gosub4030
  100. 2360 fors=1to35
  101. 2370 ifs=18then2550
  102. 2380 forb=0tobl(s)
  103. 2390 s1=s:b1=b
  104. 2400 if(s=1)and(s(s,b)=0)and(b(s,b)=1)then2540
  105. 2410 ifus(s1,b1)<0then2540
  106. 2420 ifus(s1,b1)>0thens2=sv(s1,b1):b2=bv(s1,b1):s1=s2:b1=b2:goto2420
  107. 2430 print"[147][192][192][192][192][192][192][192][192][192][192][192][192][192][192] file-start [146][192][192][192][192][192][192][192][192][192][192][192][192][192][192]";:ba=1:as=s1:ab=b1
  108. 2440 prints1,b1:us(s1,b1)=-1
  109. 2450 s2=s(s1,b1):b2=b(s1,b1):s1=s2:b1=b2
  110. 2460 ifs1<>0thenba=ba+1:goto2440
  111. 2470 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192] file-end [146][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  112. 2475 print"lenght:";ba;"blocks":print
  113. 2480 ifba<2then2540
  114. 2490 ifda$="y"thenef$="n":gosub600
  115. 2500 print"write back in directory (y/n)":poke198,0:print
  116. 2510 gete$:ife$=""then2510
  117. 2520 ife$="y"then2570
  118. 2530 ife$<>"n"then2510
  119. 2540 nextb
  120. 2550 nexts
  121. 2560 goto1050
  122. 2570 rem -------- write bam -----------
  123. 2580 s1=as:b1=ab
  124. 2590 print#15,"b-a:"0;s1;b1:gosub200
  125. 2600 s2=s(s1,b1):b2=b(s1,b1):s1=s2:b1=b2
  126. 2610 ifs1<>0then2590
  127. 2620 rem ----- write directory --------
  128. 2630 mb=1:nb=4
  129. 2640 print#15,"u1:"5;0;18;mb:gosub200
  130. 2650 print#15,"b-p:"5;0:gosub200
  131. 2660 get#5,ns$,nb$
  132. 2670 ns=asc(ns$+chr$(0))
  133. 2680 ifns<>0thengosub700:goto2640
  134. 2690 c=0
  135. 2700 get#5,a$,b$,c$
  136. 2710 ifa$=""thena$="0"
  137. 2720 ifb$=""thenb$="0"
  138. 2730 ifc$=""thenc$="0"
  139. 2740 ifa$="0"thenifb$="0"thenifc$="0"then2910
  140. 2750 fori=1to27:get#5,a$:next
  141. 2760 c=c+1:ifc<8thenget#5,a$,a$:goto2700
  142. 2770 ifmb<18then2810
  143. 2780 print"directory is full !"
  144. 2790 geta$:ifa$=""then2790
  145. 2800 goto1050
  146. 2810 print#15,"b-p:"5;0:gosub200
  147. 2820 print#5,chr$(18);
  148. 2830 print#5,chr$(nb);
  149. 2840 print#15,"u2:"5;0;18;mb:gosub200
  150. 2850 gosub700
  151. 2860 print#15,"u1:"5;0;18;mb:gosub200
  152. 2870 print#15,"b-p:"5;0:gosub200
  153. 2880 print#5,chr$(0);chr$(255);:fori=0to253:print#5,chr$(0);:next
  154. 2890 print#15,"u2:"5;0;18;mb:gosub200
  155. 2900 goto2640
  156. 2910 print"track 18 sector"mb"position"c+1:print
  157. 2920 p=2+c*32
  158. 2930 print#15,"b-p:"5;p:gosub200
  159. 2940 di$(0)=chr$(130)
  160. 2950 di$(1)=chr$(as)
  161. 2960 di$(2)=chr$(ab)
  162. 2970 fori=3to18:di$(i)=chr$(160):next
  163. 2980 ifda$="y"andef$="y"thenprint"       "dn$(d1)"[145]"
  164. 2990 input"name ";n$
  165. 3000 n$=left$(n$,16)
  166. 3010 fori=0tolen(n$)-1
  167. 3020 di$(3+i)=mid$(n$,i+1,1)
  168. 3030 next
  169. 3040 fori=19to27:di$(i)=chr$(0):next
  170. 3050 bh=int(ba/256):bl=ba-256*bh
  171. 3060 di$(28)=chr$(bl)
  172. 3070 di$(29)=chr$(bh)
  173. 3080 fori=0to29
  174. 3090 print#5,di$(i);
  175. 3100 next
  176. 3110 print#15,"u2:"5;0;18;mb:gosub200
  177. 3120 goto2540
  178. 3997 :
  179. 3998 rem ---- examine directory -------
  180. 3999 :
  181. 4000 gosub300:poke214,4:poke211,0:sys58640
  182. 4010 print"           examine directory
  183. 4020 [153]"            use  _ wait to exit
  184. 4030 print
  185. 4040 mb=1:dp=0
  186. 4050 print#15,"u1:"5;0;18;mb:gosub200
  187. 4060 print#15,"b-p:"5;0:gosub200
  188. 4070 get#5,ns$,nb$
  189. 4080 nb=asc(nb$+chr$(0))
  190. 4090 ns=asc(ns$+chr$(0))
  191. 4100 print"[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]";
  192. 4110 print"     track 18  sector"mb"-->"ns" "nb
  193. 4120 print"[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]";
  194. 4130 geta$:ifa$=""then4150
  195. 4140 ifa$="_"thenclose15:run
  196. 4150 ifns=75andnb=1then4440
  197. 4160 print
  198. 4170 print"blocks"tab(7)"name"tab(26)"typ"tab(31)"tra."tab(36)"sec.[146]"
  199. 4180 forc=0to7
  200. 4190 geta$:ifa$=""then4210
  201. 4200 ifa$="_"thenclose15:run
  202. 4210 fori=0to29
  203. 4220 get#5,di$(i)
  204. 4230 nexti
  205. 4240 ifc<>7thenget#5,a$,a$
  206. 4250 fori=0to29:di(i)=asc(di$(i)+chr$(0)):next
  207. 4260 kw$=" no more files in sector"
  208. 4270 ifdi(0)=0anddi(1)=0anddi(2)=0thenprint"      "kw$;mb"[157] [146]":print:goto4440
  209. 4280 ds(dp)=di(1):db(dp)=di(2)
  210. 4290 dl(dp)=di(29)*256+di(28)
  211. 4300 dn$(dp)="":fori=3to18:ifdi(i)<>160thendn$(dp)=dn$(dp)+di$(i)
  212. 4310 nexti
  213. 4320 dt(dp)=di(0)
  214. 4330 dp=dp+1
  215. 4340 printdi(29)*256+di(28);tab(7);chr$(34);
  216. 4350 fori=3to18:ifdi(i)<>160thenprintdi$(i);
  217. 4360 next:printchr$(34);
  218. 4370 by=di(0)and(not128):ifby=0thenprinttab(26);"del";
  219. 4380 ifby=1thenprinttab(26);"seq";
  220. 4390 ifby=2thenprinttab(26);"prg";
  221. 4400 ifby=3thenprinttab(26);"usr";
  222. 4410 ifby=4thenprinttab(26);"rel";
  223. 4420 printtab(30);di(1);tab(35);di(2)
  224. 4430 nextc
  225. 4440 mb=mb+1:ifmb<>19then4050
  226. 4450 ifda$="y"thenreturn
  227. 4460 gosub500:return
  228.